use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, Data, DeriveInput, Fields};

#[proc_macro_derive(MyMacro)]
pub fn my_macro(input :TokenStream) -> TokenStream {
    let input: DeriveInput = parse_macro_input!(input as DeriveInput);
    let identity = input.ident;
    println!("sksksksk:{}", identity);
    let d: Data = input.data;
    match d {
        Data::Struct(stru) => {
            // 字段
            let s1 = stru.fields;
            match s1 {
                Fields::Named(e) => {
                    let names = e.named.iter();
                    for i in names  {
                        
                    }
                },
                Fields::Unit => {},
                Fields::Unnamed(e) => {}
            }
            // semi 标记
            let s2 = stru.semi_token;
            // 结构体标记
            let s3 = stru.struct_token;

        },
        _ => {}
    }
    TokenStream::from(quote!(""))
}